package com.gis.bigdata.spark.core.rdd.action

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 * @author LnnuUser
 * @create 2021-08-31-下午9:17
 */
object Spark07_RDD_Operator_Action{

  def main(args: Array[String]): Unit = {
    val sp: SparkConf = new SparkConf().setMaster("local[*]").setAppName("Action")
    val sc: SparkContext = new SparkContext(sp)

    val rdd: RDD[Int] = sc.makeRDD(List(1, 2, 3, 4))

    val user: User = new User()

    rdd.foreach(
      num => {
        println("age is " + (user.age + num))
      }
    )


  }

  class User {
    var age = 30
  }
}
